import QtQuick 2.0

// 顶部消息提示弹窗

Item {
    id: root

    property int idx: 0
    property int type: 0        // 0: 正确  1: 错误  2: 警告  3: 其它
    property string text: "111"

    height: 36*dp
    width:  parent.width

    opacity: 0.95


    signal close()

    // 内容
    Rectangle{
        anchors.fill: parent
        color: type===0 ? "#F0F9EB" : (type===1 ? "#FEF0F0" : (type===2 ? "#FDF6EC" : "#F4F4F5"))
        CustomImage{
            height: 16*dp
            width: 16*dp
            source: type===0 ? "qrc:/picture/msgSuccess.png" : (type===1 ? "qrc:/picture/msgError.png" : "qrc:/picture/msgWarning.png")
            y: 10*dp
            x: 15*dp
        }

        Text {
            x: 40*dp
            anchors.verticalCenter: parent.verticalCenter
            text: root.text
            font.pixelSize: config.fontsize
            color: type===0 ? "#67C23A" : (type===1 ? "#F56C6C" : (type===2 ? "#E6A23C" : "#909399"))
        }
        CustomButton{
            button_color: "transparent"
            title: "X"
            height: 36*dp
            width: 30*dp
            text_color: "#CCCCCC"
            x: parent.width - 40*dp

            onReleased: {
                close()
            }
        }
    }


}
